package tools;

import java.util.Map;

import com.google.inject.Inject;

public class Translator {

	private static final String TRANSLATION_REF = "data.translation";
	private static final String KEY_NAME = "label";
	private final Map<String, String> trMap;

	@Inject
	public Translator (Configurator config) {
		this.trMap = config.getMapProperty(TRANSLATION_REF, KEY_NAME);
	}
	
	public String tr(String label) {
		String translated = trMap.get(label);
		if (translated == null) {
			System.out.println("No translation found for " + label);
			return label;
		}
		else {
			return translated;
		}
	}
}
